<script setup lang="ts">
import { onMounted } from 'vue'
import { useTheme } from '@/composables/useTheme'
import { useScrollbarConfig } from '@/composables/useScrollbarConfig'
import ScrollbarConfig from '@/components/ScrollbarConfig.vue'

// 初始化主题系统 - 为页面提供基础主题上下文
useTheme()

// 初始化滚动条配置系统 - 提供全局滚动条样式管理
useScrollbarConfig()

/**
 * 组件挂载时初始化主题和滚动条配置
 */
onMounted(() => {
  // 主题和滚动条配置已在对应的 composable 中自动初始化
})
</script>

<template>
  <div class="app-container">
    <!-- 背景网格效果 -->
    <div class="background-grid" />
    <router-view />

    <!-- 滚动条配置组件 -->
    <ScrollbarConfig />
  </div>
</template>

<style>
/* 确保应用容器占满全屏 */
.app-container {
  min-height: 100vh;
  position: relative;

  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* 原有的底部样式已移除，由 BottomBranding 组件替代 */

/* 背景网格效果 */
.background-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

/* 亮色主题网格 */
.light .background-grid {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 70%);
}

/* 暗色主题网格 */
.dark .background-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 70%);
}

/* 响应式网格大小 */
@media (max-width: 768px) {
  .background-grid {
    background-size: 15px 15px;
  }
}

@media (max-width: 480px) {
  .background-grid {
    background-size: 12px 12px;
    opacity: 0.4;
  }
}
</style>
